<%
## Tangent, an online sign-up sheet
## Copyright (C) 2008 Justin Ludwig and Adam Stuenkel
## 
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
-%>

<% @page_title = @event %>

<div class="vevent">

<div class="h-container">
<h1 class="summary"><%=h @event %></h1>
<span class="h1-tools">
  <%= link_to "Edit", edit_event_path(@event) if has_privilege_for_event? @event, :edit_event %>
  <%= text_link_to_delete @event if has_privilege_for_event? @event, :delete_event %>
</span>
</div>

<% if @event.start_date -%>
<div class="pre-sidebar">
  <span class="dtstart" title="<%= @event.start_date.to_s :rfc3339 %>"><%= event_starttime @event %></span>
  <% if @event.end_date -%>
  -
  <span class="dtend" title="<%= @event.end_date.to_s :rfc3339 %>"><%= event_endtime @event %></span>
  <% end -%>
</div>
<% end -%>

<div class="sidebar">
  <h5>Hosted At</h5>
  <div class="content location vcard">
    (addr)
  </div>
</div>

<div class="metadata post-sidebar">
<% unless @event.coordinators.blank? -%>
<div class="vcard">
  Coordinated by <%= link_to_array @event.coordinators, :class => 'organizer fn n url' %>
</div>
<% end -%>

<% unless @event.tag_list.blank? -%>
<div>
  Tagged as <%= list_tags @event %>
</div>
<% end -%>
</div>

<h4 class="under-sidebar">Details</h4>
<div class="description content">
<%= sanitize @event.details %>
</div>

<% if has_privilege? :view_activities %>
<table class="tbl">
<caption>Activities
  <span class="caption-tools">
    <%= link_to "Add", new_event_activity_path(@event) if has_privilege_for_event? @event, :edit_event %>
  </span>
</caption>
<thead>
  <tr>
    <th><%= link_to_order_by "Name", "name" %></th>
    <th>Tags</th>
    <th>Criteria</th>
    <th class="date"><%= link_to_order_by "Start", "start_date" %></th>
    <th class="date"><%= link_to_order_by "End", "end_date" %></th>
    <th class="number">Openings Left</th>
    <th class="tools">My Status</th>
  </tr>
</thead>
<tbody>
<% for activity in @activities %>
  <tr class="<%= cycle("", "alt") -%>">
    <td><%= link_to h(activity.name), activity %></td>
    <td><%=h activity.tag_list %></td>
    <td><%=h activity.criteria %></td>
    <td class="date"><%= activity_datetime @event, activity.start_date %></td>
    <td class="date"><%= activity_datetime @event, activity.end_date %></td>
    <td class="number"><%= activity.available %></td>
    <td class="tools"><%= link_to h(my_status_display(activity)), activity if activity.available? %></td>
  </tr>
<% end %>
</table>
<%= links_to_page @activities %>
<% end %>

<div class="timestamp">
<div>
  Created on <span class="created" title="<%= @event.created_at.to_s :rfc3339 %>"><%= @event.created_at.to_s :full %></span>
</div>
<div>
  Last modified on <span class="last-modified" title="<%= @event.updated_at.to_s :rfc3339 %>"><%= @event.updated_at.to_s :full %></span>
</div>
</div>

</div>
